<!DOCTYPE html>
<html>
<head>
<Title>TBA Activity Registration || Admin Page</Title>
	<!--a statisztika kirajzolasahoz szukseges libraryk-->
		<!-- css3 formak amelyek a design es lathatosagert felelosek-->
	<link href="Design.css" rel="stylesheet" type="text/css">
	<link rel="stylesheet" href="css/stat.css" type="text/css" media="screen" />
	<link href="style.css" rel="stylesheet" type="text/css">
	<!--a statisztika grafikon kirajzolasahoz szukseges libraryk-->
	<script src="libraries/RGraph.common.core.js" ></script>
    <script src="libraries/RGraph.common.dynamic.js" ></script>
    <script src="libraries/RGraph.common.tooltips.js" ></script>
    <script src="libraries/RGraph.common.effects.js" ></script>
	<script src="libraries/RGraph.common.key.js" ></script>
    <script src="libraries/RGraph.bar.js" ></script>
    <script src="libraries/RGraph.line.js" ></script>
    <script src="libraries/jquery.min.js" ></script>
	<script src="libraries/RGraph.common.tooltips.js" ></script>
    <script src="libraries/RGraph.hbar.js" ></script>
	</head>
	<body style="background-color:#69F;">
	<br><div id="title" style="background-color:#69F;">Statistics</div><br>
			<table id="manager">
		<td id="managerbuttons" style="vertical-align:text-top;">
			<!-- admin felulet funkcioihoz gombok amelyekhez atugorhat -->
			<!-- projekt sttaisztikakt kirajzolasa-->
			<a href="projects.php?pid=1"><button id="button" width="50">Projects</button></a><br>
			<!-- alkalmazottakrol szolo statisztikak-->
			<a href="people.php?aid=Alt.Attila5"><button id="button" width="50">Employments</button></a><br>
			<!-- activityk kezelese-->
			<a href="activityedit.php"><button id="button" width="50">Edit Activities</button></a><br>
			<!-- altalanos statisztika-->
			<a href="stat.php"><button id="button" style="width:50"> Statistics </button></a><br>
			<!-- admin jog kiosztasa-->
			<a href="usersettings.php"><button id="button" style="width:50">Edit Users</button></a><br>
			<!-- kilepes az admin feluletrol -->
			<a href="BLL.php?logout="><button id="button" style="width:50">Logout</button></a><br>
		</td>
		<td  id="managerinfo ">
			<!-- html5 canvas funkciojanak a segitsegel kirajzoljuk az adott statisztikat-->
				<canvas id="cvs" width="800" height="400">[No canvas support]</canvas>
					<!-- a script amelynek segitsegevel kirajzoljuk az adott statisztikat -->
					<script>
						window.onload = function ()
						{
						<!--atvesszuk a projekt nevek listajat, a rajtuk dolgozott napok es orak listajat-->
							var projectnamelist = [<?php include "classes.php"; $pclass = new projects; $pclass->getprojectlistdb($tmp1,$tmp2,$projectsid);echo "$tmp1";?>];
							<?php
								$i=0;
								$tmpclass = new activityhours;
								$db = $pclass -> getcountprojectdb();
								$workhourlist = "";$workdaylist = "";
								while ($i<$db){
									$tmpclass -> set_projectid($projectsid[$i]);
									$tmpclass -> getallsumactivityhourdb($workhour[$i]);
									//osszesitjuk az aktivitasi orajukat
									$workhourlist = $workhourlist."$workhour[$i]";
									//dokumentalasi orakat
									$tmpclass -> getallsumactivitydaydb($workday[$i]);
									$workdaylist = $workdaylist."$workday[$i]";
									$i++;
									if ($i<$db){$workhourlist = $workhourlist.",";$workdaylist = $workdaylist.",";}
								}
							?>
							<!--valtozokba atvesszunk az adatbazisbol egyes listakat-->
							var workhour = [<?php echo "$workhourlist";?>];
							var workday = [<?php echo "$workdaylist";?>];
							var listLen=projectnamelist.length;
							var listmerge = [];
							for (var i=0;i<listLen;i++){
								listmerge[i] = new Array(2);
								listmerge[i][0]=workhour[i];
								listmerge[i][1]=workday[i];
							}
							<!--majd kirajzoljuk grafikusan az eredmenyt-->
							var hbar = new RGraph.HBar('cvs', listmerge);
							//atadjuk az ezekhez tartozo neveket
							hbar.Set('labels', projectnamelist);
							//jelenjen meg az ertekuk egyenkent is
							hbar.Set('labels.above', true);
							//formazasi dolgok szinek, meretek meghatarozasa, keretek
							hbar.Set('colors', ['#00f','#0f0']);
							//egyes iranymutatok hogy mi mit jelol
							hbar.Set('key', ['Worked hour','Worked day']);
							hbar.Set('key.position.gutter.boxed', false);
							hbar.Set('key.position', 'gutter');
							hbar.Set('key.background', 'rgb(255,255,255)');
							//elhelyezkedesek beallitasa
							hbar.Set('hmargin', 165);
							hbar.Set('hmargin.grouped', 1);
							hbar.Set('gutter.left', 150);
							hbar.Set('gutter.bottom', 45);
							hbar.Set('background.grid.vlines', false);
							hbar.Set('background.grid.border', false);
							//effektel pedig megjeleniteni az adott statisztikat
							RGraph.Effects.HBar.Grow(hbar);
						}
					</script>
      </td>
	</table>
	</div>
	</body>
</html>